luci-app-xinetd: make the server configuration option mandatory
authorFlorian Eckert <[email protected]>
Wed, 19 Mar 2025 11:50:29 +0000 (12:50 +0100)
committerFlorian Eckert <[email protected]>
Wed, 19 Mar 2025 11:50:29 +0000 (12:50 +0100)
Signed-off-by: Florian Eckert <[email protected]>
applications/luci-app-xinetd/htdocs/luci-static/resources/view/xinetd/xinetd.js

index cf5e5d0a725bbf8241bc725a17948fae2a487b32..31d8342ff0a583a42f9d1bc18e5cbda3365816a4 100644 (file)
@@ -159,15 +159,25 @@ return view.extend({
                o.rmempty = false;
                o.modalonly = true;
 
+               o = s.taboption('basic', form.Flag, '_redirect', _('Use redirect'));
+               o.modalonly = true;
+               o.load = function(section_id) {
+                       var redirect = uci.get(this.config, section_id, 'redirect');
+                       return redirect ? 1 : 0
+               };
+               o.write = function(section_id, formvalue) {};
+
                o = s.taboption('basic', form.Value, 'redirect', _('Redirect'), _('Redirect incoming TCP requests to this IP address:port.'));
                o.datatype = 'ipaddrport(1)';
+               o.rmempty = false;
                o.modalonly = true;
+               o.depends('_redirect', '1');
 
                o = s.taboption('basic', form.Value, 'server', _('Server'), _('Complete path to the executable server file'));
                o.datatype = 'string';
                o.rmempty = false;
                o.modalonly = true;
-               o.depends('type', 'UNLISTED');
+               o.depends({ 'type': 'UNLISTED', '_redirect': '0' });
                o.validate = validateEmpty;
                o.write = function(section, value) {
                        return fs.stat(value).then(function(res) {
@@ -186,7 +196,7 @@ return view.extend({
                o = s.taboption('basic', form.Value, 'server_args', _('Server arguments'), _('Additional arguments passed to the server. There is no validation of this input.'));
                o.datatype = 'string';
                o.modalonly = true;
-               o.depends('type', 'UNLISTED');
+               o.depends({ 'type': 'UNLISTED', '_redirect': '0' });
 
                // Advanced settings
                o = s.taboption('advanced', widgets.UserSelect, 'user', _('User (UID)'), _('User ID for the server process for this service'));